<%--
  Created by IntelliJ IDEA.
  User: spoplar
  Date: 18-1-26
  Time: 上午10:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.github.wxpay.sdk.WXPay" %>
<%@ page import="com.github.wxpay.sdk.WXPayConfigImplement" %>
<%@ page import="com.github.wxpay.sdk.WXPayConfig" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>

<%
    WXPayConfig wxPayConfig  =  WXPayConfigImplement.getInstance();
    WXPay wxpay = new WXPay(wxPayConfig);
    System.out.println(wxpay);
    String out_trade_no = "201613091059590000003433-asd002";
    HashMap<String, String> data = new HashMap<String, String>();
    data.put("body", "腾讯充值中心-QQ会员充值");
    data.put("out_trade_no", out_trade_no);
    data.put("device_info", "");
    data.put("fee_type", "CNY");
    data.put("total_fee", "1");
    data.put("spbill_create_ip", "218.28.137.114"); //123.12.12.123
    data.put("notify_url", "http://test.letiantian.me/wxpay/notify");
    data.put("trade_type", "NATIVE");
    data.put("product_id", "12");
    Map<String, String> r = wxpay.unifiedOrder(data);
    request.setAttribute("data",r);
%>

<html>
<head>
    <title>Title</title>

</head>
<body>
    <c:forEach items="${data}" var="map">
        <c:out value="${map.key}"></c:out>:<c:out value="${map.value}"></c:out><br/>
    </c:forEach>
</body>
</html>
